home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-01-01 | 2.0 KB | 66 lines | [TEXT/MACA] |
- \ these values are used by text constant at run time for
- \ centering text.
- 0 Value tcLeft
- 472 Value tcRt
-
- \ tcMode determines the textMode for compiled text constants
- srcOr Value tcMode
-
- -1 Constant Ctr \ causes text to be centered
-
- \ ( addr offs -- ) fetch addr + offs as a Toolbox Int
- : @int + w@ makeInt ;
-
- \ ( addr:str255 -- centerX ) compute center val for text
- : tCenter
- +base >R word0 R> call StringWidth word0 \ width in pixels
- 2/ tcRt tcLeft - 2/ tcLeft + swap - ;
-
- \ Determine the proper Y value for the next line. This is done
- \ by adding the offset plus height of this line to the Y
- \ value of the last line (specified in tCon)
-
- \ ( height xVal offs -- height xVal yVal )
- : +lin { ht xVal offs -- ht xVal yVal } ht xVal
- latest pfa 2+ W@ \ get Y value of last tCon
- ht + 4+ offs + ;
-
- \ NL calls +lin with an offset of 0
- : NL 0 +lin ;
-
- \ Define a family of text constants that include formatting
- \ information. When the name of the constant is used, it
- \ prints itself in the proper format on the current grafPort.
-
- 1 Codefields
- Do.. >R R 4 @int call TextSize
- R 6 @int call TextFace
- R 8 @int call TextFont
- R 10 @int call TextMode
- R w@ dup ctr = \ should we center the text?
- IF drop R 12 + tCenter THEN
- R 2+ w@ gotoXY R> 12 + Count Type ..End
-
- \ A text constant is specified in the following manner:
- \ font face size locX locY tCon name "Text to print"
- \ if locX is specified as -1, the constant will be centered within
- \ global values tcLeft and tcRt.
-
- : tCon Build swap w, w, \ 0=locX, 2=locY
- w, w, w, tcMode w, \ 4=size, 6=face, 8=font, 10=mode
- word" str, ..End \ 12=len:string... 12+len
-
- \ Define text constants for the Demo.
- \ Font Face Size X Y --------------------
-
- 4 0 9 20 165
- tcon "cr1 " "
- 0 0 12 20 nl
- tcon "cr2 "Yerk Version 3.3. Formerly Neon, by Kriya Systems, Inc."
- 2 0 12 20 nl
- tcon "cr3 "Public Domain version. Copying, use, and disclosure restricted by"
- 3 0 9 20 nl
- tcon "cr4 "non-use of the word Neon"
-
- : printMe -curs "cr1 "cr2 "cr3 "cr4 ;
-